/**
 * Created with IntelliJ IDEA
 * Description:
 * User: SEKI TOMOKI
 * Date: 2023-09-19
 * Time: 11:53
 */
class Solution {
    public void rotate(int[] nums, int k) {
        int[] ret = new int[nums.length];

        if(k == nums.length){
            ret = nums;
        }else {
            k = k % nums.length;
        }

        for(int i = 0; i < nums.length; i++) {
            if(i + k > nums.length - 1) {
                ret[i + k - nums.length] = nums[i];
            }else {
                ret[i + k] = nums[i];
            }
        }

        for(int i = 0; i < nums.length; i++) {
            nums[i] = ret[i];
        }
    }
}